﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using PoemGame.Domain.Services.Jielong;
using PoemGameWebApiService.Shared;
using PoemService.Shared;

namespace PoemGameJielongWebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class JielongController : ControllerBase
    {
        private readonly IPoemService poemService;
        private readonly JielongCheckAnswerService jielongCheckAnswerService;
        private readonly JielongCheckGameConditionService jielongCheckGameConditionService;

        public JielongController(IPoemService poemService,
            JielongCheckAnswerService jielongCheckAnswerService,
            JielongCheckGameConditionService jielongCheckGameConditionService)
        {
            this.poemService = poemService;
            this.jielongCheckAnswerService = jielongCheckAnswerService;
            this.jielongCheckGameConditionService = jielongCheckGameConditionService;
        }

        [HttpPost("CheckAnswer")]
        public async Task<bool> CheckAnswer(CheckAnswerServiceDto dto)
        {
            return await jielongCheckAnswerService.CheckAnswer(dto.Input, dto.Answer);
        }

        [HttpPost("CheckCondition")]
        public async Task<bool> CheckCondition(CheckConditionServiceDto dto)
        {
            return await jielongCheckGameConditionService.CheckGameCondition(dto.Condition);
        }
    }
}
